package com.xzqwjw.taskmanager.fragment;

import java.util.List;
import java.util.Map;

import com.leaderinfo.leaderinfojxyz.R;
import com.leaderinfo.model.CategoryUnit;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TextView;

public class ShowListAdapterFragment extends Fragment {

  private String strDBFile = "";
  private ProgressDialog objPD;

  List<Map<String, Object>> listLeader = null;

  int intUnitID = 0;
  String strUnitID = "0";

  int intPrincipalNumber = 0;
  int intDeputyNumber = 0;
  int intDepth = 0;

  private TextView tvUnitName;
  private ListView lvResultByUnit;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent objIT = getActivity().getIntent();
    strDBFile = objIT.getStringExtra("DBFilePath");

    Bundle objBundle = getArguments();

    if (objBundle != null) {
      strUnitID = objBundle.getString("UnitID");
    } else {
      strUnitID = "0";
    }

  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_showlist, container,
        false);

    return view;
  }

  // ����UnitID�õ���UnitID�������Ϣ
  private CategoryUnit getUnitCategory(int intUnitID) {
    com.leaderinfo.dao.UnitCategoryDao objUnitCategoryDAO = new com.leaderinfo.dao.UnitCategoryDao(strDBFile);
    Map<String, Object> mapUnitCategory = objUnitCategoryDAO
        .getRecordByAID(intUnitID);
    if (mapUnitCategory != null) {
      return (CategoryUnit) mapUnitCategory.get("UnitCategory");
    } else {
      return null;
    }
  }

}
